li=[1,3,2,4,10,9,888,32]
n=len(li)
for i in range(1,n):
    key=li[i]
    j=i-1
    while j>=0 and li[j]>li[i]:
        li[j+1]=li[j]
        j=j-1
        li[j+1]=key
print(li)

def qui (li,p,r):
    if p<r:
        q=partion(li,p,r)
        qui(li,p,q)
        qui(li,q+1,r)
def partion(li,p,r):
    i=p-1
    for j in range(p,r):
        if li[j]<=li[r]:
            i+=1
            li[i],li[j]=li[j],li[i]
    li[i+1],li[r]=li[r],li[i+1]
    return i
lis=[1,3,2,4,10,9,888,32]
qui(lis,0,len(lis)-1)
print(lis)